<?php get_header(); ?>

<div class="content-area">
    <main class="site-main">
        <?php if (have_posts()) : ?>
            <div class="page-header">
                <h1 class="page-title"><?php single_cat_title(); ?></h1>
                <?php the_archive_description('<div class="taxonomy-description">', '</div>'); ?>
            </div>
            
            <div class="posts-list">
                <?php while (have_posts()) : the_post(); ?>
                    <article class="post-item">
                        <?php if (has_post_thumbnail()) : ?>
                            <div class="post-thumbnail">
                                <?php the_post_thumbnail(); ?>
                            </div>
                        <?php endif; ?>
                        <div class="post-content">
                            <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
                            <?php 
                            $content = get_the_content();
                            $excerpt = wp_trim_words($content, 80, '...');
                            echo '<p>' . $excerpt . '</p>';
                            ?>
                        </div>
                    </article>
                <?php endwhile; ?>
            </div>
            
            <?php the_posts_pagination(); ?>
            
        <?php else : ?>
            <p><?php _e('没有找到文章', 'my-simple-theme'); ?></p>
        <?php endif; ?>
    </main>
    
    <?php get_sidebar(); ?>
</div>

<?php get_footer(); ?>
